package ch.myDungeons.view;

import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;

import javax.swing.JFrame;

/**
 * The main Frame of the Game, containing the whole view
 * @author Grii
 *
 */

public class GameFrame extends JFrame {
	private static final long serialVersionUID = -1307189097900711809L;
	
	/** The console to be displayed */
	private Console console;
	
	/** The panel with the player info */
	private InfoView infoView;
	
	/** Contains the map panel */
	private MapView mapView;
	
	
	
	public GameFrame(int sizeX, int sizeY){
		// Some Window properties
		setLayout(null);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(sizeX, sizeY);
		sizeX -= 5;
		sizeY -= 28;
		GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
		int width = gd.getDisplayMode().getWidth();
		int height = gd.getDisplayMode().getHeight();
		setLocation((width-sizeX)/2, (height-sizeY)/2);
		setResizable(false);
		setTitle("MyDungeon");
		
		console = new Console((int)(2.0*sizeX/3.0), sizeY);
		console.setLocation(0, 0);
		
		infoView = new InfoView((int)(sizeX / 3), (int)(sizeY / 3));
		infoView.setLocation((int)(sizeX * 2 / 3), (int)(2 * sizeY / 3));
		
		mapView = new MapView((int)(sizeX / 3), (int)(2 * sizeY / 3), infoView);
		mapView.setLocation((int)(sizeX * 2 / 3), 0);
		
		add(console);
		add(mapView);
		add(infoView);
		
		setVisible(true);
	}



	public Console getConsole() {
		return console;
	}



	public InfoView getInfoView() {
		return infoView;
	}



	public MapView getMapView() {
		return mapView;
	}
}
